<%@page import="ll.sms.web.*"%><%@ page language="java"
	import="java.util.*,ll.sms.pojo.*,org.json.simple.*,java.io.*"
	pageEncoding="UTF-8"%>
<%@page import="ll.sms.util.*,org.apache.commons.lang.*"%>
<%
	String currenUser = SmsUtil.sessionHelper(session,
			AdminProperty.auname);

	String proxyid = ParamUtils.getParameter(request, "proxyid");

	if ("admin".equals(currenUser)) {
		if (proxyid == null || proxyid.trim().equals("")) {
			proxyid = SmsConstant.MESSAGE_MONITOR_FLAG;
		}
	} else {
		if (SmsConstant.MESSAGE_MONITOR_FLAG.equals(proxyid)) {
			return;
		}
		proxyid = SmsUtil.sessionHelper(session, AdminProperty.aid);
		//do nothing
	}
	int j = 10;
	String sz = request.getParameter("showsize");
	if (sz == null || sz.trim().equals("")) {
		//do nothing
	} else {
		try {
			j = Integer.parseInt(sz);
		} catch (Exception e) {
			//do nothing
		}
	}
	MessageMonitor mm = new MessageMonitor(j, proxyid);
	File f = mm.getExcel();
	response.setContentType("text/html");
	response.setHeader("Location", f.getName());

	response.setHeader("Content-Disposition", "attachment; filename="
			+ f.getName());
	OutputStream outputStream = response.getOutputStream();
	InputStream inputStream = new FileInputStream(f);
	byte[] buffer = new byte[1024];
	int i = -1;
	while ((i = inputStream.read(buffer)) != -1) {
		outputStream.write(buffer, 0, i);
	}
	outputStream.flush();
	outputStream.close();
	inputStream.close();
	outputStream = null;
	out.clear();
	out = pageContext.pushBody();

	System.out.print("over.....");
%>